import Vue from 'vue'
import Vuex from 'vuex'
import persistedState from 'vuex-persistedstate'
import app from './modules/app'
import dict from './modules/dict'
import user from './modules/user'
import tagsView from './modules/tagsView'
import permission from './modules/permission'
import settings from './modules/settings'
import getters from './getters'
import custom_dict from './modules/custom_dict'

Vue.use(Vuex)

const store = new Vuex.Store({
  getters,
  modules: {
    app,
    dict,
    user,
    permission,
    tagsView,
    settings,
    custom_dict
  },
  plugins: [
    persistedState({
      key: 'custom_dict',
      paths: ['custom_dict'] // 这里便只会缓存user下的state值
    })
  ]
})

export default store
